package com.lsy.renameAssistant;

import dev.langchain4j.memory.chat.ChatMemoryProvider;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RenameAgentConfig {


    @Autowired
    private RenameChatMemoryStore renameChatMemoryStore;

    static String path="C:/javaCode/ruoyi/java-langchain4j-template/src/main/resources";


    @Bean
    ChatMemoryProvider chatMemoryProviderRename() {
        return memoryId -> MessageWindowChatMemory.builder()
        .id(memoryId)
        .maxMessages(20)
        .chatMemoryStore(renameChatMemoryStore)
        .build();
    }

//    @Bean
//    ContentRetriever contentRetrieverMysql() {
//        //使用FileSystemDocumentLoader读取指定目录下的知识库文档
//        //并使用默认的文档解析器对文档进行解析
//        Document document1 = FileSystemDocumentLoader.loadDocument(path+"/医院信息.md");
//        Document document2 = FileSystemDocumentLoader.loadDocument(path+"/科室信息.md");
//        Document document3 = FileSystemDocumentLoader.loadDocument(path+"/神经内科.md");
//        List<Document> documents = Arrays.asList(document1, document2, document3);
//        //使用内存向量存储
//        InMemoryEmbeddingStore<TextSegment> embeddingStore = new InMemoryEmbeddingStore<>();
//        //使用默认的文档分割器
//        EmbeddingStoreIngestor.ingest(documents, embeddingStore);
//        //从嵌入存储（EmbeddingStore）里检索和查询内容相关的信息
//        return EmbeddingStoreContentRetriever.from(embeddingStore);
//    }
}

